#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"

void test_council_room_effect()
{
	int currentPlayer;
	struct gameState state;
	int handPos;

	currentPlayer = 0;
	handPos = 0;

	state.numBuys = 1;
	state.numPlayers = 3;

	state.handCount[1] = 5;
	state.handCount[2] = 5;
	state.handCount[currentPlayer] = 5;

	int old_currentPlayer_hand_count;
	old_currentPlayer_hand_count = state.handCount[currentPlayer];

	int other_player_hand_counts[2] = {
		state.handCount[1], state.handCount[0]
	};

	cardEffect(council_room, 0, 0, 0, &state, handPos, 0);

	/* Test One: Current Player draws four more cards. */
	if (state.handCount[currentPlayer] == (old_currentPlayer_hand_count + 4)) {
		printf("Test One: PASS\n");
	}
	else {
		printf("Test One: FAIL - did not draw four new cards\n");
	}

	/* Test Two: Player gets one more buy */
	if (state.numBuys == 2) {
		printf("Test Two: PASS\n");
	}
	else {
		printf("Test Two: FAIL - did not increase number of buys by one\n");
	}

	/* Test Three: All other players draw one more card*/
	int cnt = 0;
	int i;

	for (i = 1; i < state.numPlayers; i++) {
		if (state.handCount[i] == (other_player_hand_counts[i] + 1)) {
			cnt++;
		}
	}

	if (cnt == 3) {
		printf("Test Three: PASS\n");
	}
	else {
		printf("Test Three: FAIL - did not draw one card for each other player\n");
	}

	/* Test Four: Discard council room card */
	// TODO
}

int main(void)
{
	test_council_room_effect();
	return EXIT_SUCCESS;
}